﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Employees;

namespace Companies
{
    public class Company
    {
        public string CompanyCode;
        public string CompanyDescription;
        public List<Employee> Employees;
        public int CompanyId;
        public List<int> CompaniesIds;

        List<int> companiesIds = new List<int>();

       internal int CompanyId_Generator()
        {
            Random randomID = new Random();
            int Id=randomID.Next();

            foreach (var id in companiesIds)
            {
                if (id != Id)
                {
                    companiesIds.Add(Id);
                    return Id;
                }
            }

            return -1;
        }

        public Company(string companyCode, string companyDescription)
        {
            this.CompanyCode = companyCode;
            this.CompanyDescription = companyDescription;
            //Random randomID = new Random();
            //this.CompanyId = randomID.Next();

            CompanyId= CompanyId_Generator();
        }


       
    }
}
